<?php $this->load->view('headerfooter/header'); ?>
      <!-- Begin page content -->
<div class="container">
	<div class="col-sm-4 col-sm-offset-1">
		<div class="panel panel-success">
			<div class="panel-heading">
				<div class="panel-title">
					<div class="title-white"><?=$title?></div>
				</div>
			</div>
			<div class="panel-isi">
			<?php if(!isset($message)) $message = $this->session->flashdata('message'); 
				//get notification message if exist ?>
			
			<?php if($message != null):
				//if notification message exist ?>
				<div class="alert alert-warning">
					<button type="button" class="close" data-dismiss="alert">&times;</button>
					<?=$message?>
				</div>
			<?php endif; ?>
			
			<?php if($this->session->userdata('role') == 1): 
				//menu option for admin ?>
				<div class="admin-box">
					<a href="<?=site_url('user/manajemen');?>" class="btn btn-primary"><i class="fa fa-users"></i> Lihat User</a>
					<a href="<?=site_url('user/tambah_user');?>" class="btn btn-danger"><i class="fa fa-plus"></i> Tambah User</a>
				</div>
			<?php endif; ?>
			
			<?php foreach($user->result() as $row) : 
				// show user detail ?>
				<!--div class="text-center">
				<h3>Selamat datang, <?=$row->nama_lengkap?> !</h3>
				</div -->	
				<table class="table">
						<form class="form-inline" action="<?=site_url('user/edit_nama')?>" method="post" role="form">
							<tr>
								<th width="20%">ID</th>
								<td><?=$row->idloginuser?></td>
								<td><input type="hidden" name="id" value="<?=$row->idloginuser?>"></td>
							</tr>
							<tr>
								<th width="20%">Username</th>
								<td colspan="2"><?=$row->nama_user?></td>
							</tr>
							<tr>
								<th width="20%">Nama Lengkap</th>
								<td><input class="form-control" type="text" name="nama-lengkap" value="<?=$row->nama_lengkap?>" required></td>
								<td width="20%"><button type="submit" class="btn btn-danger btn-block"><i class="fa fa-pencil"></i> Ubah Nama</button></td>
								
							</tr>
							<tr>
								<th width="20%">Role</th>
								<td colspan="2">
									<?php
										$role = $row->role; 
										if($role==1): ?>
										Master Admin
									<?php elseif($role==2): ?>
										Editor
									<?php elseif($role==3): ?>
										User
									<?php endif; ?>
								</td>
							</tr>
						</form>
					<?php endforeach; ?>
				</table>
				<a href="<?=site_url('user/edit_password')?>" class="btn btn-lg btn-primary btn-block"><i class="fa fa-lock"></i> Ubah Password</a>
			</div>
		</div>
	</div>
</div>
<?php $this->load->view('headerfooter/footer'); ?>
